package com.lin.controller;

import com.lin.dataobject.Banner;
import com.lin.dataobject.UpdateLog;
import com.lin.server.BannerService;
import com.lin.server.UpdateLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;
import java.util.Map;

/**
 * Created by Administrator on 2017/9/25.
 */
@Controller
//@RestController
@RequestMapping("/")
public class SellerHomeController {
    @Autowired
    private UpdateLogService updateLogService;

    @Autowired
    private BannerService bannerService;

    @RequestMapping("/main/index")
    public ModelAndView index(Map<String, Object> map) {
        List<UpdateLog> updateLogList = updateLogService.findAllOrder();
        List<Banner> banners= bannerService.findAllEffective();
        map.put("updateLog", updateLogList);
        map.put("banners",banners);
        return new ModelAndView("index/mainpage",map);
    }

    @RequestMapping("/main")
    public ModelAndView main(){
        return new ModelAndView("index/index1");
    }
}
